package com.object;

public enum OtaTarget{
    STM_HOST("STM32主机", (byte)0x01),BLE_HOST("蓝牙主机", (byte)0x02), BLE_SLAVE("蓝牙从机", (byte)0x03), UNKNOWN("未知升级目标类型", (byte)0xFF);

    private final String info;
    private final byte value;


    private OtaTarget(String info, byte value){
        this.info = info;
        this.value = value;
    }

    public byte getValue(){return this.value;}

    public String getInfo(){return this.info;}

    public static OtaTarget checkTarget(byte code){
        switch(code){
            case (byte)0x01:
                return STM_HOST;
            case (byte)0x02:
                return BLE_HOST;
            case (byte)0x03:
                return BLE_SLAVE;
            default:
                return UNKNOWN;

        }
    }




}



